<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/**
<span class='line'>  2</span>  * @fileoverview A jQuery plugin for OpenSocial Compatibiblity
<span class='line'>  3</span>  * @author Atushi Nagase
<span class='line'>  4</span>  * @copyright Copyright (C) Atsushi Nagase
<span class='line'>  5</span>  * @license The Apache License, version 2
<span class='line'>  6</span>  * @see &lt;a href="http://code.google.com/p/jopensocial/">Google Code&lt;/a>
<span class='line'>  7</span>  */</span><span class="WHIT">
<span class='line'>  8</span>  
<span class='line'>  9</span> </span><span class="COMM">/** @class
<span class='line'> 10</span>  * @name jQuery */</span><span class="WHIT">
<span class='line'> 11</span> </span><span class="COMM">/** @namespace
<span class='line'> 12</span>  * @name jQuery.opensocial */</span><span class="WHIT">
<span class='line'> 13</span> </span><span class="COMM">/** @namespace
<span class='line'> 14</span>  * @name jQuery.opensocial.data */</span><span class="WHIT">
<span class='line'> 15</span> </span><span class="COMM">/** @namespace
<span class='line'> 16</span>  * @name jQuery.opensocial.activity */</span><span class="WHIT">
<span class='line'> 17</span> </span><span class="COMM">/** @namespace
<span class='line'> 18</span>  * @name jQuery.gadgets */</span><span class="WHIT">
<span class='line'> 19</span> 
<span class='line'> 20</span> </span><span class="PUNC">;</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 21</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">window.opensocial</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="STRN">"opensocial-v0.* feature is required."</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 22</span> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">window.gadgets.views</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="STRN">"views feature is required."</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 23</span> </span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 24</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">jQuery</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 25</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">domain</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.getEnvironment</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">getDomain</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 26</span> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 27</span> 
<span class='line'> 28</span> </span><span class="COMM">// _____________private_____________</span><span class="WHIT">
<span class='line'> 29</span> 
<span class='line'> 30</span> </span><span class="COMM">/**
<span class='line'> 31</span>  * @private
<span class='line'> 32</span>  */</span><span class="WHIT">
<span class='line'> 33</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">_request</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">map</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ns</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 34</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">req</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">ns</span><span class="PUNC">||</span><span class="NAME">opensocial</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">newDataRequest</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 35</span> 	</span><span class="NAME">$.each</span><span class="PUNC">(</span><span class="NAME">map</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 36</span> 		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="PUNC">(</span><span class="KEYW">this</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="STRN">"function"</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 37</span> 			</span><span class="NAME">req.add</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">this.call</span><span class="PUNC">(</span><span class="NAME">req</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 38</span> 	</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 39</span> 	</span><span class="NAME">req.send</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">res</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 40</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 41</span> 		</span><span class="NAME">$.each</span><span class="PUNC">(</span><span class="NAME">map</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 42</span> 			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">item</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">res.get</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 43</span> 			</span><span class="NAME">obj</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">item.hadError</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">error</span><span class="PUNC">:</span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">item.getData</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 44</span> 		</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 45</span> 		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="STRN">"function"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 46</span> 	</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 47</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 48</span> 
<span class='line'> 49</span> </span><span class="KEYW">var</span><span class="WHIT">
<span class='line'> 50</span> 	</span><span class="NAME">_cachedPeople</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> 
<span class='line'> 51</span> 	</span><span class="NAME">_cachedData</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 52</span> 	</span><span class="NAME">_ownerId</span><span class="PUNC">,</span><span class="WHIT"> 
<span class='line'> 53</span> 	</span><span class="NAME">_viewerId</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 54</span> 
<span class='line'> 55</span> </span><span class="COMM">// _____________public_____________</span><span class="WHIT">
<span class='line'> 56</span> 
<span class='line'> 57</span> 
<span class='line'> 58</span> </span><span class="COMM">/**
<span class='line'> 59</span>  * Contianer information
<span class='line'> 60</span>  * @name jQuery.opensocial.container
<span class='line'> 61</span>  * @field
<span class='line'> 62</span>  */</span><span class="WHIT">
<span class='line'> 63</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">container</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 64</span> 	</span><span class="NAME">myspace</span><span class="WHIT">	</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="REGX">/myspace\.com/</span><span class="PUNC">.</span><span class="NAME">test</span><span class="PUNC">(</span><span class="NAME">domain</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 65</span> 	</span><span class="NAME">google</span><span class="WHIT">	</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="REGX">/google\.com/</span><span class="PUNC">.</span><span class="NAME">test</span><span class="PUNC">(</span><span class="NAME">domain</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 66</span> 	</span><span class="NAME">orkut</span><span class="WHIT">	</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="REGX">/orkut\.com/</span><span class="PUNC">.</span><span class="NAME">test</span><span class="PUNC">(</span><span class="NAME">domain</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 67</span> 	</span><span class="NAME">mixi</span><span class="WHIT">	</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="REGX">/mixi/</span><span class="PUNC">.</span><span class="NAME">test</span><span class="PUNC">(</span><span class="NAME">domain</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 68</span> 	</span><span class="NAME">partuza</span><span class="WHIT">	</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="REGX">/partuza\.nl/</span><span class="PUNC">.</span><span class="NAME">test</span><span class="PUNC">(</span><span class="NAME">domain</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 69</span> 	</span><span class="NAME">goo</span><span class="WHIT">		</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="REGX">/^goo\.ne\.jp$/</span><span class="PUNC">.</span><span class="NAME">test</span><span class="PUNC">(</span><span class="NAME">domain</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 70</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 71</span> 
<span class='line'> 72</span> </span><span class="COMM">/**
<span class='line'> 73</span>  * Alias for gadgets.util.registerOnLoadHandler
<span class='line'> 74</span>  * @name jQuery.gadgets.ready
<span class='line'> 75</span>  * @function
<span class='line'> 76</span>  * @see &lt;a href="http://code.google.com/apis/opensocial/docs/0.8/reference/gadgets/#gadgets.util.registerOnLoadHandler">gadgets.util.registerOnLoadHandler&lt;/a>
<span class='line'> 77</span>  */</span><span class="WHIT">
<span class='line'> 78</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">ready</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 79</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 80</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">fnc</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 81</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">params</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">gadgets.views.getParams</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 82</span> 		</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">,</span><span class="NAME">params</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 83</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 84</span> 	</span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 85</span> 		</span><span class="NAME">gadgets.util.registerOnLoadHandler</span><span class="PUNC">(</span><span class="NAME">fnc</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 86</span> 	</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 87</span> 		</span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">fnc</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 88</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 89</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 90</span> 
<span class='line'> 91</span> </span><span class="COMM">/**
<span class='line'> 92</span>  * Navigate to view by view name as string.&lt;br />
<span class='line'> 93</span>  * Returns next view.&lt;br />
<span class='line'> 94</span>  * If view is not set, returns current view.
<span class='line'> 95</span>  * @name jQuery.gadgets.view
<span class='line'> 96</span>  * @function
<span class='line'> 97</span>  * @param view
<span class='line'> 98</span>  * @param opt_params
<span class='line'> 99</span>  * @param no_navigate Boolean
<span class='line'>100</span>  * @returns gadgets.views.View
<span class='line'>101</span>  */</span><span class="WHIT">
<span class='line'>102</span> 
<span class='line'>103</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">view</span><span class="PUNC">(</span><span class="NAME">view</span><span class="PUNC">,</span><span class="NAME">opt_params</span><span class="PUNC">,</span><span class="NAME">no_navigate</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>104</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">view</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">gadgets.views.getCurrentView</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>105</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_getViewObject</span><span class="PUNC">(</span><span class="NAME">view</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>106</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>107</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">no_navigate</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">gadgets.views.requestNavigateTo</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">,</span><span class="NAME">opt_params</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>108</span> 	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>109</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>110</span> 
<span class='line'>111</span> </span><span class="COMM">/**
<span class='line'>112</span>  * @private */</span><span class="WHIT">
<span class='line'>113</span> 
<span class='line'>114</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">_getViewObject</span><span class="PUNC">(</span><span class="NAME">view</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>115</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">gadgets</span><span class="PUNC">||</span><span class="PUNC">!</span><span class="NAME">gadgets.views</span><span class="PUNC">||</span><span class="PUNC">!</span><span class="NAME">gadgets.views.getSupportedViews</span><span class="PUNC">||</span><span class="PUNC">!</span><span class="NAME">view</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>116</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">rtn</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>117</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">view.match</span><span class="PUNC">(</span><span class="REGX">/^canvas$|^home$|^profile$/i</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">view</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">container.myspace</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">view.toUpperCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">view.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>118</span> 	</span><span class="NAME">$.each</span><span class="PUNC">(</span><span class="NAME">gadgets.views.getSupportedViews</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>119</span> 		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">this.getName</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="NAME">view</span><span class="PUNC">||</span><span class="NAME">i</span><span class="PUNC">==</span><span class="NAME">view</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>120</span> 			</span><span class="NAME">rtn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>121</span> 			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>122</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>123</span> 	</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>124</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">rtn</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">rtn</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>125</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>126</span> 
<span class='line'>127</span> </span><span class="COMM">/**
<span class='line'>128</span>  * Alias for gadgets.views.getParams()
<span class='line'>129</span>  * @name jQuery.gadgets.viewParams
<span class='line'>130</span>  * @function
<span class='line'>131</span>  * @see &lt;a href="http://code.google.com/apis/opensocial/docs/0.8/reference/gadgets/#gadgets.views.getParams">gadgets.views.getParams&lt;/a>
<span class='line'>132</span>  */</span><span class="WHIT">
<span class='line'>133</span> 
<span class='line'>134</span> </span><span class="COMM">/**
<span class='line'>135</span>  * Get and set gadget height
<span class='line'>136</span>  * @name jQuery.gadgets.height
<span class='line'>137</span>  * @function
<span class='line'>138</span>  * @param opt_height auto:String/height:uint
<span class='line'>139</span>  * @returns gadget height
<span class='line'>140</span>  */</span><span class="WHIT">
<span class='line'>141</span> 
<span class='line'>142</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">gadgetHeight</span><span class="PUNC">(</span><span class="NAME">opt_height</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>143</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">window.gadgets.window</span><span class="PUNC">||</span><span class="PUNC">!</span><span class="NAME">window.gadgets.window.adjustHeight</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">throw</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Error</span><span class="PUNC">(</span><span class="STRN">"dynamic-height feature is required."</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>144</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">opt_height</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">gadgets.window.adjustHeight</span><span class="PUNC">(</span><span class="NAME">opt_height</span><span class="PUNC">==</span><span class="STRN">"auto"</span><span class="PUNC">?</span><span class="KEYW">null</span><span class="PUNC">:</span><span class="NAME">opt_height</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>145</span> 	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">gadgets.window.getViewportDimensions</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">height</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>146</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>147</span> 
<span class='line'>148</span> </span><span class="COMM">/**
<span class='line'>149</span>  * Get gadget width
<span class='line'>150</span>  * @name jQuery.gadgets.width
<span class='line'>151</span>  * @function
<span class='line'>152</span>  * @returns gadget width
<span class='line'>153</span>  */</span><span class="WHIT">
<span class='line'>154</span> 
<span class='line'>155</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">gadgetWidth</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>156</span> 	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">gadgets.window.getViewportDimensions</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">width</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>157</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>158</span> 
<span class='line'>159</span> </span><span class="COMM">/**
<span class='line'>160</span>  * @private */</span><span class="WHIT">
<span class='line'>161</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">_makeRequest</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="NAME">data</span><span class="PUNC">,</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="NAME">type</span><span class="PUNC">,</span><span class="NAME">is_post</span><span class="PUNC">,</span><span class="NAME">num_entries</span><span class="PUNC">,</span><span class="NAME">get_summaries</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>162</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">url</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>163</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="STRN">"function"</span><span class="PUNC">&&</span><span class="PUNC">!</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>164</span> 		</span><span class="NAME">get_summaries</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">num_entries</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>165</span> 		</span><span class="NAME">num_entries</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">is_post</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>166</span> 		</span><span class="NAME">is_post</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">type</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>167</span> 		</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>168</span> 		</span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>169</span> 		</span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>170</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>171</span> 	</span><span class="NAME">num_entries</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">isNaN</span><span class="PUNC">(</span><span class="NAME">num_entries</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NUMB">3</span><span class="PUNC">:</span><span class="NAME">num_entries</span><span class="WHIT">
<span class='line'>172</span> 	</span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>173</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">)</span><span class="PUNC">!=</span><span class="STRN">"string"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$.param</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>174</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">param</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>175</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">is_post</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>176</span> 		</span><span class="NAME">param</span><span class="PUNC">[</span><span class="NAME">gadgets.io.RequestParameters.POST_DATA</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>177</span> 	</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>178</span> 		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">url.search</span><span class="PUNC">(</span><span class="REGX">/\?/</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">url</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">"?"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>179</span> 		</span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">url.match</span><span class="PUNC">(</span><span class="REGX">/.*&$/</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">url</span><span class="PUNC">+</span><span class="PUNC">=</span><span class="STRN">"&"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>180</span> 		</span><span class="NAME">url</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>181</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>182</span> 	</span><span class="NAME">param</span><span class="PUNC">[</span><span class="NAME">gadgets.io.RequestParameters.CONTENT_TYPE</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">gadgets.io.ContentType</span><span class="PUNC">[</span><span class="NAME">type</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>183</span> 	</span><span class="NAME">param</span><span class="PUNC">[</span><span class="NAME">gadgets.io.RequestParameters.METHOD</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">gadgets.io.MethodType</span><span class="PUNC">[</span><span class="NAME">is_post</span><span class="PUNC">?</span><span class="STRN">"POST"</span><span class="PUNC">:</span><span class="STRN">"GET"</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>184</span> 	</span><span class="NAME">param</span><span class="PUNC">[</span><span class="NAME">gadgets.io.RequestParameters.AUTHORIZATION</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">gadgets.io.AuthorizationType.NONE</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>185</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">==</span><span class="STRN">"FEED"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>186</span> 		</span><span class="NAME">param</span><span class="PUNC">[</span><span class="NAME">gadgets.io.RequestParameters.NUM_ENTRIES</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">num_entries</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>187</span> 		</span><span class="NAME">param</span><span class="PUNC">[</span><span class="NAME">gadgets.io.RequestParameters.GET_SUMMARIES</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="PUNC">!</span><span class="NAME">get_summaries</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='line'>188</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>189</span> 	</span><span class="COMM">//Authorization not supported.</span><span class="WHIT">
<span class='line'>190</span> 	</span><span class="NAME">gadgets.io.makeRequest</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">res</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>191</span> 		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">res</span><span class="PUNC">||</span><span class="PUNC">!</span><span class="NAME">res.data</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">(</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>192</span> 		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">==</span><span class="STRN">"JSON"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">res.data</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>193</span> 		</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">res.data</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='line'>194</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">param</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>195</span> 	
<span class='line'>196</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>197</span> </span><span class="COMM">/**
<span class='line'>198</span>  * Get JSON content
<span class='line'>199</span>  * @name jQuery.gadgets.getJSON
<span class='line'>200</span>  * @function
<span class='line'>201</span>  * @param url
<span class='line'>202</span>  * @param data
<span class='line'>203</span>  * @param callback
<span class='line'>204</span>  * @example $.gadgets.getJSON(
<span class='line'>205</span>  *   "http://domain.tld/path/to/json",
<span class='line'>206</span>  *   { entry_id:"123" }, // GET parameters
<span class='line'>207</span>  *   function(d) { console.log(d); });
<span class='line'>208</span>  */</span><span class="WHIT">
<span class='line'>209</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">getJSON</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="NAME">data</span><span class="PUNC">,</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>210</span> 	</span><span class="NAME">_makeRequest</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="NAME">data</span><span class="PUNC">,</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="STRN">"JSON"</span><span class="PUNC">,</span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>211</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>212</span> 
<span class='line'>213</span> 
<span class='line'>214</span> </span><span class="COMM">/**
<span class='line'>215</span>  * Get XML content as jQuery object
<span class='line'>216</span>  * @name jQuery.gadgets.ajax
<span class='line'>217</span>  * @function
<span class='line'>218</span>  * @param url
<span class='line'>219</span>  * @param data
<span class='line'>220</span>  * @param callback
<span class='line'>221</span>  * @example $.gadgets.ajax(
<span class='line'>222</span>  *   "http://jopensocial.googlecode.com/svn/trunk/tests/test.xml",
<span class='line'>223</span>  *   { entry_id:"123" }, // GET parameters
<span class='line'>224</span>  *   function(d) { alert($("Require",d).attr("feature")); });
<span class='line'>225</span>  */</span><span class="WHIT">
<span class='line'>226</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">getXML</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="NAME">data</span><span class="PUNC">,</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> 
<span class='line'>227</span> 	</span><span class="NAME">_makeRequest</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="NAME">data</span><span class="PUNC">,</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="STRN">"DOM"</span><span class="PUNC">,</span><span class="KEYW">false</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>228</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>229</span> 
<span class='line'>230</span> </span><span class="COMM">/**
<span class='line'>231</span>  * Get Feed content as JSON Object
<span class='line'>232</span>  * @name jQuery.gadgets.getFeed
<span class='line'>233</span>  * @function
<span class='line'>234</span>  * @param url
<span class='line'>235</span>  * @param data
<span class='line'>236</span>  * @param callback
<span class='line'>237</span>  * @param num_entries
<span class='line'>238</span>  * @param get_summaries
<span class='line'>239</span>  * @example $.gadgets.getFeed(
<span class='line'>240</span>  *   "http://code.google.com/feeds/p/jopensocial/svnchanges/basic",
<span class='line'>241</span>  *   { entry_id:"123" }, // GET parameters
<span class='line'>242</span>  *   function(d) { console.log(d); },
<span class='line'>243</span>  *   10, // 10 entries; default is 3
<span class='line'>244</span>  *   false, // will not get summaries; default is false
<span class='line'>245</span>  * );
<span class='line'>246</span>  */</span><span class="WHIT">
<span class='line'>247</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">getFeed</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="NAME">data</span><span class="PUNC">,</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="NAME">num_entries</span><span class="PUNC">,</span><span class="NAME">get_summaries</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> 
<span class='line'>248</span> 	</span><span class="NAME">_makeRequest</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="NAME">data</span><span class="PUNC">,</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="STRN">"FEED"</span><span class="PUNC">,</span><span class="KEYW">false</span><span class="PUNC">,</span><span class="NAME">num_entries</span><span class="PUNC">,</span><span class="NAME">get_summaries</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>249</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>250</span> 
<span class='line'>251</span> </span><span class="COMM">/**
<span class='line'>252</span>  * Post content and get content with callback 
<span class='line'>253</span>  * @name jQuery.gadgets.post
<span class='line'>254</span>  * @function
<span class='line'>255</span>  * @param url
<span class='line'>256</span>  * @param data
<span class='line'>257</span>  * @param callback
<span class='line'>258</span>  * @param type gadgets.io.ContentType
<span class='line'>259</span>  * @example $.gadgets.post(
<span class='line'>260</span>  *   "http://domain.tld/path/to/json",
<span class='line'>261</span>  *   { entry_id:"123" }, // POST data
<span class='line'>262</span>  *   function(d) { console.log(d); },
<span class='line'>263</span>  *   "JSON");
<span class='line'>264</span>  */</span><span class="WHIT">
<span class='line'>265</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">postData</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="NAME">data</span><span class="PUNC">,</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="NAME">type</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> 
<span class='line'>266</span> 	</span><span class="NAME">_makeRequest</span><span class="PUNC">(</span><span class="NAME">url</span><span class="PUNC">,</span><span class="NAME">data</span><span class="PUNC">,</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">||</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">toUpperCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>267</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>268</span> 
<span class='line'>269</span> </span><span class="COMM">/**
<span class='line'>270</span>  * Fetch UserAppData
<span class='line'>271</span>  * @name jQuery.opensocial.data.get
<span class='line'>272</span>  * @function
<span class='line'>273</span>  * @param key
<span class='line'>274</span>  * @param userId
<span class='line'>275</span>  * @param callback
<span class='line'>276</span>  * @param useCache
<span class='line'>277</span>  * @returns cachedData
<span class='line'>278</span>  * @example $.opensocial.data.get(
<span class='line'>279</span>  *   "sampledata",
<span class='line'>280</span>  *   "viewer",
<span class='line'>281</span>  *   function(d) { console.log(d); },
<span class='line'>282</span>  *   false);
<span class='line'>283</span>  */</span><span class="WHIT">
<span class='line'>284</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">fetchAppData</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">userId</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">useCache</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>285</span> 	</span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>286</span> 	</span><span class="NAME">userId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">userId</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">opensocial.IdSpec.PersonId.VIEWER</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>287</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">key</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>288</span> 		</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>289</span> 		</span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>290</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>291</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">multi_key</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">key</span><span class="PUNC">==</span><span class="STRN">"*"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">key</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>292</span> 	
<span class='line'>293</span> 	</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">_decode</span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>294</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>295</span> 		</span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>296</span> 			</span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">gadgets.json.parse</span><span class="PUNC">(</span><span class="NAME">decodeURIComponent</span><span class="PUNC">(</span><span class="NAME">gadgets.util.unescapeString</span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>297</span> 		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>298</span> 			</span><span class="NAME">r</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>299</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>300</span> 		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>301</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>302</span> 	
<span class='line'>303</span> 	</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">_setval</span><span class="PUNC">(</span><span class="NAME">k</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">vals</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>304</span> 		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">k</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">"id"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">vals</span><span class="PUNC">[</span><span class="NAME">k</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>305</span> 		</span><span class="NAME">_cachedData</span><span class="PUNC">[</span><span class="NAME">k</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_cachedData</span><span class="PUNC">[</span><span class="NAME">k</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>306</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">multi_key</span><span class="PUNC">?</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">:</span><span class="NAME">v</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">//container.mixi?res.userData[key]:res.userData[id][key];</span><span class="WHIT">
<span class='line'>307</span> 		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">multi_key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>308</span> 			</span><span class="NAME">$.each</span><span class="PUNC">(</span><span class="NAME">v</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">kk</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">vv</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>309</span> 				</span><span class="NAME">val</span><span class="PUNC">[</span><span class="NAME">kk</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_decode</span><span class="PUNC">(</span><span class="NAME">vv</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>310</span> 				</span><span class="NAME">_cachedData</span><span class="PUNC">[</span><span class="NAME">k</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">kk</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">[</span><span class="NAME">kk</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>311</span> 			</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>312</span> 		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>313</span> 			</span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_decode</span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>314</span> 			</span><span class="NAME">_cachedData</span><span class="PUNC">[</span><span class="NAME">k</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>315</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>316</span> 		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">vals</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">vals</span><span class="PUNC">[</span><span class="NAME">k</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>317</span> 		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">val</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>318</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>319</span> 	
<span class='line'>320</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ids</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">userId.match</span><span class="PUNC">(</span><span class="REGX">/^(viewer|owner)_friends$/i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>321</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ov</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">userId.match</span><span class="PUNC">(</span><span class="REGX">/^viewer$|^owner$/i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>322</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">ids</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>323</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">idSpec</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.newIdSpec</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">userId</span><span class="PUNC">:</span><span class="NAME">ids</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">toUpperCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">groupId</span><span class="PUNC">:</span><span class="STRN">"FRIENDS"</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>324</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>325</span> 			</span><span class="NAME">peopleData</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.newFetchPersonAppDataRequest</span><span class="PUNC">(</span><span class="NAME">idSpec</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">key</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NAME">key</span><span class="PUNC">:</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>326</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>327</span> 		</span><span class="NAME">_request</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">res</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>328</span> 			</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">res.peopleData</span><span class="PUNC">||</span><span class="PUNC">!</span><span class="NAME">res.peopleData</span><span class="PUNC">[</span><span class="NAME">id</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>329</span> 				</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>330</span> 				</span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>331</span> 			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>332</span> 			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">res.peopleData</span><span class="PUNC">||</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>333</span> 			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">vals</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT"> 
<span class='line'>334</span> 			</span><span class="NAME">$.each</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">k</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">_setval</span><span class="PUNC">(</span><span class="NAME">k</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">v</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">vals</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>335</span> 			</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">vals</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>336</span> 		</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>337</span> 	</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>338</span> 		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">ov</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">userId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ov</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">toUpperCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>339</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">psn</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">person</span><span class="PUNC">(</span><span class="NAME">userId</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">psn</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>340</span> 			</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">psn</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>341</span> 				</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>342</span> 			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>343</span> 			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">psn.getId</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>344</span> 			</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">useCache</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">_cachedData</span><span class="PUNC">[</span><span class="NAME">id</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">_cachedData</span><span class="PUNC">[</span><span class="NAME">id</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">!=</span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>345</span> 				</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">_cachedData</span><span class="PUNC">[</span><span class="NAME">id</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>346</span> 				</span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>347</span> 			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>348</span> 			</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>349</span> 				</span><span class="NAME">userData</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.newFetchPersonAppDataRequest</span><span class="PUNC">(</span><span class="NAME">opensocial.newIdSpec</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="NAME">userId</span><span class="PUNC">:</span><span class="NAME">userId</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">key</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">Array</span><span class="PUNC">)</span><span class="PUNC">?</span><span class="NAME">key</span><span class="PUNC">:</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>350</span> 			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>351</span> 			</span><span class="NAME">_request</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">res</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>352</span>   			</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">res.userData</span><span class="PUNC">||</span><span class="PUNC">!</span><span class="NAME">res.userData</span><span class="PUNC">[</span><span class="NAME">id</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>353</span> 					</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>354</span> 					</span><span class="KEYW">return</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>355</span> 				</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>356</span> 				</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">res.userData</span><span class="PUNC">[</span><span class="NAME">id</span><span class="PUNC">]</span><span class="PUNC">||</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>357</span> 				</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_setval</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">data</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>358</span> 				</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>359</span> 			</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>360</span> 		</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>361</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">psn</span><span class="PUNC">?</span><span class="NAME">psn.getId</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>362</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">cache</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_cachedData</span><span class="PUNC">[</span><span class="NAME">id</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>363</span> 		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">cache</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>364</span> 		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">multi_key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">cache</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>365</span> 		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">cache</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>366</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>367</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>368</span> 
<span class='line'>369</span> </span><span class="COMM">/**
<span class='line'>370</span>  * Update UserAppData; VIEWER Only.
<span class='line'>371</span>  * @name jQuery.opensocial.data.set
<span class='line'>372</span>  * @function
<span class='line'>373</span>  * @param key
<span class='line'>374</span>  * @param value
<span class='line'>375</span>  * @param callback
<span class='line'>376</span>  */</span><span class="WHIT">
<span class='line'>377</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">updateAppData</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">// VIEWER only</span><span class="WHIT">
<span class='line'>378</span> 	</span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>379</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>380</span> 	</span><span class="NAME">person</span><span class="PUNC">(</span><span class="STRN">"viewer"</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">psn</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>381</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">psn</span><span class="PUNC">?</span><span class="NAME">psn.getId</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">:</span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>382</span> 		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">&&</span><span class="NAME">_cachedData</span><span class="PUNC">[</span><span class="NAME">id</span><span class="PUNC">]</span><span class="PUNC">&&</span><span class="NAME">_cachedData</span><span class="PUNC">[</span><span class="NAME">id</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">_cachedData</span><span class="PUNC">[</span><span class="NAME">id</span><span class="PUNC">]</span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">value</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>383</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>384</span> 			</span><span class="NAME">userData</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>385</span> 				</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.newUpdatePersonAppDataRequest</span><span class="PUNC">(</span><span class="NAME">opensocial.IdSpec.PersonId.VIEWER</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">encodeURIComponent</span><span class="PUNC">(</span><span class="NAME">gadgets.json.stringify</span><span class="PUNC">(</span><span class="NAME">value</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>386</span> 			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>387</span> 		</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>388</span> 		</span><span class="NAME">_request</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">res</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>389</span> 			</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>390</span> 		</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">	
<span class='line'>391</span> 	</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>392</span> 	
<span class='line'>393</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>394</span> </span><span class="COMM">/**
<span class='line'>395</span>  * Remove UserAppData; VIEWER Only.
<span class='line'>396</span>  * @name jQuery.opensocial.data.remove
<span class='line'>397</span>  * @function
<span class='line'>398</span>  * @param key
<span class='line'>399</span>  * @param callback
<span class='line'>400</span>  */</span><span class="WHIT">
<span class='line'>401</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">removeAppData</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="NAME">key</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> 
<span class='line'>402</span> 	</span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>403</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">key</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">(</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">  </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>404</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>405</span> 		</span><span class="NAME">userData</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>406</span> 			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.newRemovePersonAppDataRequest</span><span class="PUNC">(</span><span class="NAME">opensocial.IdSpec.PersonId.VIEWER</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">key</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>407</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>408</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>409</span> 	</span><span class="NAME">_request</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">res</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>410</span> 		</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="KEYW">true</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>411</span> 	</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>412</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>413</span> 
<span class='line'>414</span> </span><span class="COMM">/**
<span class='line'>415</span>  * Returns cached person; Get person with callback
<span class='line'>416</span>  * @name jQuery.opensocial.person
<span class='line'>417</span>  * @function
<span class='line'>418</span>  * @param id
<span class='line'>419</span>  * @param callback
<span class='line'>420</span>  * @returns Cached person or null
<span class='line'>421</span>  * @see &lt;a href="http://code.google.com/apis/opensocial/docs/0.8/reference/#opensocial.Person_method_summary">Class opensocial.Person&lt;/a>
<span class='line'>422</span>  */</span><span class="WHIT">
<span class='line'>423</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">person</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">,</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>424</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">id</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>425</span> 		</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>426</span> 		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>427</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>428</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">!=</span><span class="STRN">"function"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>429</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">um</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">id.match</span><span class="PUNC">(</span><span class="REGX">/^OWNER$|^VIEWER$/i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>430</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">um</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>431</span> 		</span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">um</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">toUpperCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>432</span> 		</span><span class="KEYW">switch</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>433</span> 			</span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">"VIEWER"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_viewerId</span><span class="PUNC">||</span><span class="NAME">id</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>434</span> 			</span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">"OWNER"</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">_ownerId</span><span class="PUNC">||</span><span class="NAME">id</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>435</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>436</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>437</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">_cachedPeople</span><span class="PUNC">[</span><span class="NAME">id</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>438</span> 		</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">_cachedPeople</span><span class="PUNC">[</span><span class="NAME">id</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>439</span> 		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">_cachedPeople</span><span class="PUNC">[</span><span class="NAME">id</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>440</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>441</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>442</span> 		</span><span class="NAME">userId</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>443</span> 			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.newFetchPersonRequest</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>444</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>445</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>446</span> 	</span><span class="NAME">_request</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">res</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>447</span> 		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">res</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">(</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>448</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">user</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">res</span><span class="PUNC">[</span><span class="STRN">"userId"</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>449</span> 		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">user</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">(</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>450</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">user.getId</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>451</span> 		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">id</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">(</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>452</span> 		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">res</span><span class="PUNC">&&</span><span class="NAME">res</span><span class="PUNC">[</span><span class="STRN">"userId"</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>453</span> 			</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">user.isViewer</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">_viewerId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">id</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>454</span> 			</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">user.isOwner</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">_ownerId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">id</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>455</span> 			</span><span class="NAME">_cachedPeople</span><span class="PUNC">[</span><span class="NAME">id</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">user</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>456</span> 			</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">user</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>457</span> 		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">(</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>458</span> 	</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>459</span> 	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>460</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>461</span> 
<span class='line'>462</span> </span><span class="COMM">/**
<span class='line'>463</span>  * Get cached people
<span class='line'>464</span>  * @name jQuery.opensocial.people
<span class='line'>465</span>  * @function
<span class='line'>466</span>  * @returns Map.&lt;id,person&gt;
<span class='line'>467</span>  */</span><span class="WHIT">
<span class='line'>468</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">getCachedPeople</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>469</span> 	</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">_cachedPeople</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>470</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>471</span> 
<span class='line'>472</span> </span><span class="COMM">/**
<span class='line'>473</span>  * Get friends as array with callback&lt;br />
<span class='line'>474</span>  * The people will be cached.
<span class='line'>475</span>  * @name jQuery.opensocial.getPeople
<span class='line'>476</span>  * @function
<span class='line'>477</span>  * @param userId default VIEWER
<span class='line'>478</span>  * @param opt_params
<span class='line'>479</span>  * @param callback
<span class='line'>480</span>  * @param return_object
<span class='line'>481</span>  */</span><span class="WHIT">
<span class='line'>482</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">getPeople</span><span class="PUNC">(</span><span class="NAME">userId</span><span class="PUNC">,</span><span class="NAME">opt_params</span><span class="PUNC">,</span><span class="NAME">callback</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">return_object</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>483</span> 	</span><span class="NAME">userId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">userId</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">"VIEWER"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>484</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">um</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">userId.match</span><span class="PUNC">(</span><span class="REGX">/^OWNER$|^VIEWER$/i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>485</span> 	</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">um</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">userId</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">um</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">toUpperCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>486</span> 	</span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>487</span> 	</span><span class="NAME">opt_params</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opt_params</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>488</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">idspec</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.newIdSpec</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT"> </span><span class="NAME">userId</span><span class="PUNC">:</span><span class="NAME">userId</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">groupId</span><span class="PUNC">:</span><span class="STRN">"FRIENDS"</span><span class="WHIT"> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>489</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>490</span> 	</span><span class="NAME">f</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.DataRequest.PeopleRequestFields.FILTER</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>491</span> 	</span><span class="NAME">opt_params</span><span class="PUNC">[</span><span class="NAME">f</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opt_params</span><span class="PUNC">[</span><span class="NAME">f</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">opensocial.DataRequest.FilterType.ALL</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>492</span> 	</span><span class="NAME">f</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial.DataRequest.PeopleRequestFields.MAX</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>493</span> 	</span><span class="NAME">opt_params</span><span class="PUNC">[</span><span class="NAME">f</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opt_params</span><span class="PUNC">[</span><span class="NAME">f</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NUMB">1000</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>494</span> 	</span><span class="NAME">_request</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>495</span> 		</span><span class="NAME">people</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>496</span> 			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.newFetchPeopleRequest</span><span class="PUNC">(</span><span class="NAME">idspec</span><span class="PUNC">,</span><span class="NAME">opt_params</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>497</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>498</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">res</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>499</span> 		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">res</span><span class="PUNC">||</span><span class="PUNC">!</span><span class="NAME">res.people</span><span class="PUNC">||</span><span class="NAME">res.people.error</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>500</span> 			</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="KEYW">null</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>501</span> 			</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>502</span> 		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>503</span> 		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ar</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>504</span> 		</span><span class="NAME">res.people.each</span><span class="PUNC">(</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">p</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>505</span> 			</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">return_object</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">ar.push</span><span class="PUNC">(</span><span class="NAME">p</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>506</span> 			</span><span class="NAME">_cachedPeople</span><span class="PUNC">[</span><span class="NAME">p.getId</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">p</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>507</span> 		</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>508</span> 		</span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">return_object</span><span class="PUNC">?</span><span class="NAME">res.people</span><span class="PUNC">:</span><span class="NAME">ar</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>509</span> 	</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>510</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>511</span> 
<span class='line'>512</span> 
<span class='line'>513</span> </span><span class="COMM">/**
<span class='line'>514</span>  * Send Activity
<span class='line'>515</span>  * @name jQuery.opensocial.activity.send
<span class='line'>516</span>  * @function
<span class='line'>517</span>  * @param title String
<span class='line'>518</span>  * @param body String
<span class='line'>519</span>  * @param hi_priority Boolean
<span class='line'>520</span>  * @param opt_params Map&gt;opensocial.Activity.Field,value&lt;
<span class='line'>521</span>  * @param callback Function
<span class='line'>522</span>  */</span><span class="WHIT"> 
<span class='line'>523</span> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">sendActivity</span><span class="PUNC">(</span><span class="NAME">title</span><span class="PUNC">,</span><span class="NAME">body</span><span class="PUNC">,</span><span class="NAME">hi_priority</span><span class="PUNC">,</span><span class="NAME">opt_params</span><span class="PUNC">,</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>524</span> 	</span><span class="NAME">opt_params</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opt_params</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>525</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">prm</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>526</span> 	</span><span class="NAME">prm</span><span class="PUNC">[</span><span class="NAME">opensocial.Activity.Field.TITLE</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">title</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>527</span> 	</span><span class="NAME">prm</span><span class="PUNC">[</span><span class="NAME">opensocial.Activity.Field.BODY</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">body</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>528</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">ns</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">opensocial</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">//container.mixi?mixi:opensocial;</span><span class="WHIT">
<span class='line'>529</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">a</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ns.newActivity</span><span class="PUNC">(</span><span class="NAME">$.extend</span><span class="PUNC">(</span><span class="NAME">opt_params</span><span class="PUNC">,</span><span class="NAME">prm</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>530</span> 	</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">pri</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">ns.CreateActivityPriority</span><span class="PUNC">[</span><span class="NAME">hi_priority</span><span class="PUNC">?</span><span class="STRN">"HI"</span><span class="PUNC">:</span><span class="STRN">"LOW"</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>531</span> 	</span><span class="NAME">ns.requestCreateActivity</span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">,</span><span class="NAME">pri</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>532</span> 		</span><span class="KEYW">if</span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="PUNC">(</span><span class="NAME">callback</span><span class="PUNC">)</span><span class="PUNC">==</span><span class="STRN">"function"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="NAME">callback</span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">&&</span><span class="PUNC">!</span><span class="NAME">e.hadError</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>533</span> 		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>534</span> 	</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>535</span> </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>536</span> 
<span class='line'>537</span> </span><span class="NAME">$.extend</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>538</span> 	</span><span class="NAME">opensocial</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>539</span> 		</span><span class="NAME">container</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">container</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>540</span> 		</span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>541</span> 			</span><span class="NAME">get</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">fetchAppData</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>542</span> 			</span><span class="NAME">set</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">updateAppData</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>543</span> 			</span><span class="NAME">remove</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">removeAppData</span><span class="WHIT">
<span class='line'>544</span> 		</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>545</span> 		</span><span class="NAME">activity</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>546</span> 			</span><span class="NAME">send</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">sendActivity</span><span class="WHIT">
<span class='line'>547</span> 		</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>548</span> 		</span><span class="NAME">person</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">person</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>549</span> 		</span><span class="NAME">people</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">getCachedPeople</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>550</span> 		</span><span class="NAME">getPeople</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">getPeople</span><span class="WHIT">
<span class='line'>551</span> 	</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>552</span> 	</span><span class="NAME">gadgets</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>553</span> 		</span><span class="NAME">ready</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">ready</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>554</span> 		</span><span class="NAME">view</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">view</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>555</span> 		</span><span class="NAME">viewParams</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">gadgets.views.getParams</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>556</span> 		</span><span class="NAME">height</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">gadgetHeight</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>557</span> 		</span><span class="NAME">width</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">gadgetWidth</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>558</span> 		</span><span class="NAME">getJSON</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">getJSON</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>559</span> 		</span><span class="NAME">getFeed</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">getFeed</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>560</span> 		</span><span class="NAME">ajax</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">getXML</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>561</span> 		</span><span class="NAME">post</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">postData</span><span class="WHIT">
<span class='line'>562</span> 	</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>563</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>564</span> 
<span class='line'>565</span> </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>566</span> </span></pre></body></html>